/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo.tabla;

import modelo.ConsultasExterna;
import java.sql.Date;
import java.sql.Time;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author dam2b
 */
public class JTableModelConsultasExternas extends AbstractTableModel {

    private Vector<String> vColumnNames;
    private ArrayList<ConsultasExterna> vdatosceldas;

    public JTableModelConsultasExternas(Vector<String> vColumnNames, ArrayList<ConsultasExterna> vdatosceldas) {
        this.vColumnNames = vColumnNames;
        this.vdatosceldas = vdatosceldas;
    }

    public void setVdatosceldas(ArrayList<ConsultasExterna> vdatosceldas) {
        this.vdatosceldas = vdatosceldas;
    }

    @Override
    public int getRowCount() {
        return vdatosceldas.size();
    }

    @Override
    public int getColumnCount() {
        return vColumnNames.size();
    }

    @Override
    public Object getValueAt(int row, int column) {
        ConsultasExterna m = vdatosceldas.get(row);
        Object retorno = null;

        if (column == 0) {
            retorno = m.getIdConsulta();
        } else if (column == 1) {
            retorno = m.getFecha();
        } else if (column == 2) {
            retorno = m.getHoraEntrada();
        } else if (column == 3) {
            retorno = m.getHoraSalida();
        } else if (column == 4) {
            retorno = m.getEspecialidad();
        } else if (column == 5) {
            retorno = m.getIdPA();
        }
        return retorno;
    }

    @Override
    public Class<?> getColumnClass(int col) {
        if (col == 0) {

            return int.class;
        } else if (col == 1) {

            return Date.class;
        } else if (col == 2) {
            return Time.class;
        } else if (col == 3) {
            return Time.class;
        } else if (col == 4) {
            return String.class;
        } else if (col == 5) {
            return int.class;
        } else {
            return null;
        }
    }
}
